<%@ page contentType="text/html;charset=ISO8859_1" language="java" %>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="nested" %>

<jsp:useBean id="oNavigate" class="git.bankview.wl.bean.TransNavigateBean" />
<jsp:setProperty name="oNavigate" property="transid" value="90010" />
<%
	session.removeAttribute("jasperFile");
	session.removeAttribute("jasperUploadFileName");
	session.removeAttribute("jasperParams");
	session.removeAttribute("jasperProps");
	session.removeAttribute("accessories");
	session.removeAttribute("accessoryFileNames");
%>
<html:html locale="true">
<head>
	<title><logic:iterate id="element" name="oNavigate" property="navigateList"
	><bean:write name="element" property="translabel" />
	 - </logic:iterate><bean:message key="report.UploadMainJasperForm.title" /></title>
	<link rel="stylesheet" href="../style/default_aux.css">
	<link rel="stylesheet" href="../style/pp.css">
</head>
<body onload="oninit()">
	<script src="../script/overlib.js" language="JavaScript"></script>
	<script src="../script/style.js" language="JavaScript"></script>
	<script src="../script/windows.js" language="JavaScript"></script>
	<table cellspacing="0" class="filledframe">
		<tr>
			<td nowrap="" class="clientframe">
				<table id="oHelp" class="helper" >
					<tr>
						<td width="200" class="label">&nbsp;</td>
						<td class="help"><input type="button" class="button" title="<bean:message key="common.help.title" />" onclick="help('help.report.schd');" value="<bean:message key="common.help" />" ></td>
					</tr>
				</table>
				<form action="/report/UploadMainJasper.do" enctype="multipart/form-data" method="post" id="oNewForm" onsubmit="return onSubmitCheck()">
					<div class="listtitle"><logic:iterate id="element" name="oNavigate" property="navigateList"
						><logic:empty name="element" property="pageurl"><bean:write name="element" property="translabel" /></logic:empty
						><logic:notEmpty name="element" property="pageurl"><a href="<bean:write name="element" property="pageurl" />" title="<bean:write name="element" property="transid" />"><bean:write name="element" property="translabel" /></a></logic:notEmpty
						><img src="/images/navconn.gif" ></logic:iterate><bean:message key="report.NewReportTrans.title" 
						/></div>
					<!-- div class="listtitle"><bean:message key="report.NewReportTrans.title" /></div -->
					<div class="subtitle"><bean:message key="report.newTrans.step1" />
						<br><html:errors /></div>
					<table id="oPropPagesTab"></table>
					<!---------------- main file upload properties page BEGIN ----------------->
					<div id="ppMain">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><table cellspacing="1"><tr>
								<td nowrap class="label"><bean:message key="report.prop.mainObj" /></td>
								<td nowrap ><input name="jasperFile" type="file" class="text" onfocus="onFieldFocus()" onblur="onFieldBlur()" tabindex="101" />
									</td>
							</tr></table></td></tr>
							<tr><td class="input">&nbsp;</td></tr>
							<tr><td class="input"><bean:message key="report.newTrans.step1desc" /></td></tr>
							<tr><td class="bottompad">&nbsp;</td></tr>
						</table>
					</div>
					<!---------------- main file upload properties page END ----------------->
					
					<!---------------- accessories upload properties page BEGIN ----------------->
					<div id="ppAccessories">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><bean:message key="report.newTrans.step2desc" /></td></tr>
							<tr><td class="input"><table cellspacing="1" id="oAccContainer"></table></td></tr>
							<tr><td class="input"><input onclick="addAccessory()" type="button" class="button" value="<bean:message key="common.add" />" ></td></tr>
							<tr><td class="bottompad">&nbsp;</td></tr>
						</table>
					</div>
					<!---------------- accessories upload properties page END ----------------->
					
					<table width="500" class="formpanelbar">
						<tr>
							<td align="right" nowrap="">
								<html:submit tabindex="1001" styleClass="button">
									<bean:message key="common.submit" /></html:submit></td>
						</tr>
					</table>
				</form>
			</td>
		</tr>
	</table>
	
<script language="javascript">
function oninit()
{
	initPropertyPageTable(oPropPagesTab, 500, 320);
	addPropertyPage(oPropPagesTab, ppMain, "<bean:message key="report.pp.mainobj" />");
	addPropertyPage(oPropPagesTab, ppAccessories, "<bean:message key="report.pp.accessories" />");
	setPropertyPageActive(oPropPagesTab, 0);
}
var g_fileObjCount = 0;
function addAccessory()
{
	var row = oAccContainer.insertRow();
	row.id = "oFoc" + (++g_fileObjCount);
	var c = row.insertCell();
	c.className = "label";
	c.innerText = "<bean:message key="report.prop.accessoryObj" />";
	c = row.insertCell();
	var fileObj = document.createElement("<input name=\"accessories\" type=\"file\" class=\"text\" onfocus=\"onFieldFocus()\" onblur=\"onFieldBlur()\" tabindex=\"201\" />");
	var removeButton = document.createElement("<input class=\"button\" onclick=\"removeAccessory(" + row.id + ")\" type=\"button\" value=\"<bean:message key="common.delete" />\" >");
	c.appendChild(fileObj);
	c.appendChild(removeButton);
	//alert(oFoc1.innerHTML);
}
function removeAccessory(r)
{
	var rows = oAccContainer.rows;
	var i;
	for (i = 0; i < rows.length; ++i)
	{
		if (rows[i] == r)
		{
			oAccContainer.deleteRow(i);
			break;
		}
	}
}
function onSubmitCheck()
{
	if (0 == oNewForm.jasperFile.value.length)
	{
		alert("<bean:message key="jasperUpload.err.emptyMainFile" />");
		return false;
	}
	
	if (undefined == oNewForm.accessories)
	{
	}
	else if (undefined == oNewForm.accessories.length)
	{
		if (0 == oNewForm.accessories.value.length)
		{
			alert("<bean:message key="jasperUpload.err.emptyAccessoryFile" />");
			return false;
		}
	}
	else
	{
		var i;
		for (i = 0; i < oNewForm.accessories.length; ++i)
		{
			if (0 == oNewForm.accessories[i].value.length)
			{
				alert("<bean:message key="jasperUpload.err.emptyAccessoryFile" />");
				return false;
			}
		}
	}
	
	return true;
}
</script>

</body>
</html:html>









